//
//  RemindViewController.m
//  SmartWatch
//
//  Created by zwj on 2022/11/22.
//

#import "RemindViewController.h"

@interface RemindViewController ()
@property(nonatomic,strong) UIView *topBackView;
@end

@implementation RemindViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setIsHideNavigationBar:YES];
    self.view.backgroundColor = [UIColor qmui_colorWithHexString:@"#F1F4F4"];
    FlexFrameView *view = [[FlexFrameView alloc]initWithFlex:@"RemindViewController" Frame:self.view.bounds Owner:self];
    [self.view addSubview:view];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setGradientLayerForTopContainer) name:FLEXDIDLAYOUT object:nil];
}

- (void)backClick {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)setGradientLayerForTopContainer {
    
    CAGradientLayer *gl = [CAGradientLayer layer];
    gl.frame = self.topBackView.bounds;
    gl.startPoint = CGPointMake(0.5, 0);
    gl.endPoint = CGPointMake(0.5, 1);
    gl.colors = @[(__bridge id)[UIColor qmui_colorWithHexString:@"#FFD0A5"].CGColor, (__bridge id)[UIColor qmui_colorWithHexString:@"#F1F4F4"].CGColor];
    gl.locations = @[@(0), @(1.0f)];
    UIGraphicsBeginImageContext(self.topBackView.size);
    [gl renderInContext:UIGraphicsGetCurrentContext()];
    UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    self.topBackView.backgroundColor = [UIColor colorWithPatternImage:image];

}

@end
